{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "26ac9307-ca6d-427e-94de-540ae73b6f9d",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/shortest-distance-to-a-character\n",
    "\n",
    "\n",
    "Runtime: 80 ms, faster than 19.86% of Python3 online submissions for Shortest Distance to a Character.\n",
    "Memory Usage: 14.4 MB, less than 59.59% of Python3 online submissions for Shortest Distance to a Character.\n",
    "\n",
    "\n",
    "```\n",
    "class Solution:\n",
    "    def shortestToChar(self, s: str, c: str) -> List[int]:\n",
    "        #3:35\n",
    "        target_index = []\n",
    "        for index, char in enumerate(s):\n",
    "            if char == c:\n",
    "                target_index.append(index)\n",
    "        result_list = []\n",
    "        for index, char in enumerate(s):\n",
    "            result_list.append(min([abs(index - target) for target in target_index]))\n",
    "        return result_list\n",
    "        #3:39\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fed58d1f-f626-4efe-988d-4ca99cfa9384",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
